package com.gitee.wsl.service.task

import com.gitee.wsl.service.task.listener.AbstractTaskListener
import com.gitee.wsl.service.task.listener.TaskListener
import com.gitee.wsl.service.task.scope.RetryAbleTaskScope

interface RetryAbleTask<SCOPE: RetryAbleTaskScope,STATUS>
    : Task<SCOPE, STATUS>,
    RetryAbleTaskScope,
    TaskListener<SCOPE>



abstract class AbstractRetryAbleTask<SCOPE: RetryAbleTaskScope,STATUS>(initStatus: STATUS, adapter: AbstractTaskListener<SCOPE>?=null):
    AbstractTask<SCOPE, STATUS>(initStatus,adapter), RetryAbleTask<SCOPE, STATUS> {

    var retryCount=0

    /*override fun retry(): Int {
        return retryCount
    }*/

    override fun fireRetry(scope: SCOPE) {
        retryFun?.invoke(scope)
    }

}